home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / gnu / cvs-1_3.lha / cvs-1.3 / contrib / log.pl < prev    next >
Perl Script  |  1992-03-16  |  2KB  |  105 lines

  1. #!/usr/bin/perl
  2.  
  3. # Modified by berliner@Sun.COM to add support for CVS 1.3    2/27/92
  4. #
  5. # Date: Tue, 6 Aug 91 13:27 EDT
  6. # From: samborn@sunrise.com (Kevin Samborn)
  7. #
  8. # I revised the perl script I sent you yesterday to use the info you
  9. # send in on stdin.  (I am appending the newer script to the end)
  10. #
  11. # now the output looks like this:
  12. #
  13. #    **************************************
  14. #    date: Tuesday, August 6, 1991 @ 13:17
  15. #    author: samborn
  16. #    Update of /elmer/cvs/CVSROOT.adm
  17. #    In directory astro:/home/samborn/CVSROOT.adm
  18. #    
  19. #    Modified Files:
  20. #        test3 
  21. #    
  22. #    Added Files:
  23. #        test6 
  24. #    
  25. #    Removed Files:
  26. #        test4 
  27. #    
  28. #    Log Message:
  29. #    wow, what a test
  30. #    
  31. #    RCS:    1.4     /elmer/cvs/CVSROOT.adm/test3,v
  32. #    RCS:    1.1     /elmer/cvs/CVSROOT.adm/test6,v
  33. #    RCS:    1.1     /elmer/cvs/CVSROOT.adm/Attic/test4,v
  34. #
  35.  
  36. #
  37. # turn off setgid
  38. #
  39. $) = $(;
  40.  
  41. #
  42. # parse command line arguments
  43. #
  44. @files = split(/ /,$ARGV[0]);
  45. $logfile = $ARGV[1];
  46. $cvsroot = $ENV{'CVSROOT'};
  47.  
  48. #
  49. # Some date and time arrays
  50. #
  51. @mos = (January,February,March,April,May,June,July,August,September,
  52.         October,November,December);
  53. @days = (Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday);
  54. ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime;
  55.  
  56. #
  57. # get login name
  58. #
  59. $login = getlogin || (getpwuid($<))[0] || "nobody";
  60.  
  61. #
  62. # open log file for appending
  63. #
  64. if ((open(OUT, ">>" . $logfile)) != 1) {
  65.     die "Could not open logfile " . $logfile . "\n";
  66. }
  67.  
  68. # Header
  69. print OUT "\n";
  70. print OUT "**************************************\n";
  71. print OUT "date: " . $days[$wday] . ", " . $mos[$mon] . " " . $mday . ", 19" . $year .
  72.     " @ " . $hour . ":" . sprintf("%02d", $min) . "\n";
  73. print OUT "author: " . $login . "\n";
  74.  
  75. #
  76. #print the stuff on stdin to the logfile
  77. #
  78. open(IN, "-");
  79. while(<IN>) {
  80.    print OUT $_;
  81. }
  82. close(IN);
  83.  
  84. print OUT "\n";
  85.  
  86. #
  87. # after log information, do an 'cvs -Qn status' on each file in the arguments.
  88. #
  89. for $file (@files[1..$#files]) {
  90.     if ($file eq "-") {
  91.     last;
  92.     }
  93.     open(RCS,"-|") || exec 'cvs', '-Qn', 'status', $file;
  94.     while (<RCS>) {
  95.         if (substr($_, 0, 7) eq "    RCS") {
  96.             print OUT;
  97.         }
  98.     }
  99.     close (RCS);
  100. }
  101.  
  102. close (OUT);
  103.